/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.br.telas;

import com.br.utils.Util;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

/**
 *
 * @author Cassiano
 */
public class TelaPrincipal extends javax.swing.JFrame {

    /**
     * Creates new form TelaPrinciapl
     */
    public TelaPrincipal() {
        initComponents();
  
        //colocando o icone da agenda
        this.setIconImage(new ImageIcon(getClass().getResource("/com/br/imagens/acStoreRodape.png")).getImage());
        
        // maximiza a tela
        setExtendedState(MAXIMIZED_BOTH);
        
    }
    
    public void itensMenu() {
        //Criando o Menu Cadastro
        JMenu cadastro = new JMenu();
        cadastro.setText("CADASTRO");

        //Criando o Menu Rotina
        JMenu rotina = new JMenu();
        rotina.setText("ROTINA");

        //Criando o Menu Sistema
        JMenu sistema = new JMenu();
        sistema.setText("SISTEMA");

    
        //Acrescentando os Menus criado acima a barra de menu da tela principal
        menuBar.add(cadastro);
        menuBar.add(rotina);
        menuBar.add(sistema);
    
        //Criando o Item de menu chamado Cliente
        JMenuItem clientes = new JMenuItem();
        clientes.setText("CLIENTES");
        cadastro.add(clientes);
        clientes.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //chamando a tela ao ser clicado no menu
                telaCliente();
            }
        });  
        
        //Criando o Item de menu chamado Cliente
        JMenuItem colaboradores = new JMenuItem();
        colaboradores.setText("COLABORADORES");
        cadastro.add(colaboradores);
        colaboradores.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //chamando a tela ao ser clicado no menu
                telaColaborador();
            }
        });  
        
        //Criando o Item de menu chamado Venda
        JMenuItem vendas = new JMenuItem();
        vendas.setText("VENDA");
        rotina.add(vendas);
        vendas.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //chamando a tela ao ser clicado no menu
            }
        }); 
        
        //Criando o Item de menu chamado Ajuda
        JMenuItem ajuda = new JMenuItem();
        ajuda.setText("AJUDA");
        sistema.add(ajuda);
        ajuda.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            }
        });
        
        //Criando o Item de menu chamado Sair
        JMenuItem sair = new JMenuItem();
        sair.setText("SAIR");
        sistema.add(sair);
        sair.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
    }
        //metodos para chamar as telas
    private void telaCliente() {
        TelaCliente tela = new TelaCliente(this, true);
        tela.setVisible(true);
    }
    
    private void telaColaborador() {
        TelaColaborador tela = new TelaColaborador(this, true);
        tela.setVisible(true);
    }
    
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        menuBar = new javax.swing.JMenuBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("AC - STORE");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 647, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 386, Short.MAX_VALUE)
        );

        menuBar.setPreferredSize(new java.awt.Dimension(0, 20));
        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables
}
